<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者，助力会务会议发展
// +----------------------------------------------------------------------
// | Copyright (c) 2017～2024  All rights reserved.
// +----------------------------------------------------------------------
// | 沃德会务会议系统并不是自由软件，不加密，并不代表开源，未经许可不可自由转售和商用
// +----------------------------------------------------------------------
// | Author: MY WORLD Team <bd@maiwd.cn>   www.maiwd.cn
// +----------------------------------------------------------------------
/**
 * Class UserWechat
 * Desc  微信用户控制器
 * Create on 2024/3/16 9:14
 * Create by wangyafang
 */

namespace app\api\controller\wddj\user;



use app\common\controller\Api;


class UserWechat extends Api
{
    protected $noNeedLogin = [''];
    protected $noNeedRight = ['*'];
    protected $model = null;

    public function _initialize()
    {
        parent::_initialize();
        $this->model = new \app\api\model\wddj\user\UserWechat();
    }

    /**
     * Desc  个人中心
     * Create on 2024/3/16 9:15
     * Create by wangyafang
     */
    public function center()
    {
        if (!$this->request->isGet()) {
            $this->error('请求类型错误');
        }
        $wechat_id = $this->model->where('user_id', $this->auth->id)->value('id');
        if (!$wechat_id) {
            $this->error('用户信息不存在,请删除小程序，重新登录');
        }
        $data = $this->model->where('id', $wechat_id)->field("nickname")->find();

        $data['avatar'] = wddj_full_url('/assets/addons/wddj/img/user.png');

        $this->success('请求成功', $data);
    }


}



 